package a2;

public class EllipseArray {
	static private Ellipse[] store;
	private static int num = 0;
	static int first = 0;
	private static int total = 0;
	
	/**
	 * EllipseArray default constructor
	 */
	public EllipseArray() 
	{
		
	}
    /**
     * Alternate Constructor
     * @require size > 0
     * @ensure num < size
     */
	public EllipseArray(Ellipse ell,int size) {
		assert(size > 0);
		if(first == 0)
		{
		store = new Ellipse[size];
		first = 1;
		}
		
		//If the user creates more then they can be stored delete oldest
		if(num > size - 1)
			store[0] = ell;
		else
		{
			store[num] =ell;
			num++;
		}
		assert(num <= size);
	}
	
	/**
	 * num get method
	 */
	public int getNum()
	{return num;}
	/**
	 * total get method
	 */
	public int getTotal()
	{return total;}
	
	
	public String toString(int x)
	{
		double circumfrence =store[x].circumference();
		double area = store[x].area();
		return "Major Axis: " + store[x].majorAxis() + " " + "Minor Axis: " + store[x].minor_axis() + " " + "Circumfrence: " + String.format("%.2f",circumfrence) + " Area: " + String.format("%.2f",area);
	}

	/**
	 * store get method
	 */
	public Ellipse get() 
	{
		return store[num - 1];
	}

}
